MongoDB and PHP by Francia Steve

MongoDB and PHP by Francia Steve

Author:Francia, Steve [Steve Francia]
Language: eng
Format: epub
Tags: COMPUTERS / Database Management / General
ISBN: 9781449324841
Publisher: O'Reilly Media, Inc.
Published: 2012-01-22T16:00:00+00:00


MongoDB permits you to run updates and deletions on multiple documents at the same time.

Updating Multiple Records

By default the update (or save) methods only work on a single document. Both have an additional parameter that accepts an array of options. To update all documents that match the criteria provided, simply pass in array("multiple" => true) in the third parameter.

Note

Multiple updates are individually atomic, but not atomic as a group. MongoDB doesn’t have the ability to have atomicity across the update set, but each individual document will be updated atomically.

A Multiple update is also nonblocking, meaning that other updates can happen while the update is occurring, even on the same data. The way to prevent this is to provide the $atomic option, which confusingly isn’t atomic, but isolated. When set to true, the multi update (or delete) will be blocking, ensuring that no other operations happen during this operation on that data set.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.